
project(qt)


#
#odb --std c++11 -d mysql --profile qt --generate-schema --generate-query --generate-session -I /usr/include/x86_64-linux-gnu/qt5 -fPIC employee.hxx

add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/employee-odb.hxx
        ${CMAKE_CURRENT_SOURCE_DIR}/employee-odb.cxx
        PRE_BUILD
        COMMAND echo "-----qt---------"
        COMMAND odb -I /usr/include/x86_64-linux-gnu/qt5 --std c++11 -DQT_BOOTSTRAPPED -d mysql --profile qt --generate-schema --generate-query --generate-session employee.hxx
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

#过滤文件
file(GLOB source
        "*.hxx"
        "*.cxx"
        )




add_executable(${PROJECT_NAME} ${source})

target_link_libraries(${PROJECT_NAME}
        PUBLIC Qt5::Core
        PRIVATE ${ODB_LIBRARY_VAR}
        PRIVATE  ${ODB_MYSQL_LIBRARY_VAR}
        PRIVATE  ${ODB_QT_LIBRARY_VAR})